#ifndef _WIIMOTE_WII_H
#define _WIIMOTE_WII_H

struct WPADStatus;
#include "./wiimote.h"
#include <vector>
#include "math/vec2.h"

//#define VISUALIZE_WIIMOTE	// uncomment this line to enable visualization in the wiimote. It takes up a lot of RAM and CPU, though, so make sure it's #ifdef'ed out if not in use.e

class wiimote;
namespace input
{

class	WiimoteWii : public WiimoteAbstract
{
public:
								WiimoteWii();
	virtual 					~WiimoteWii();
	virtual void				Init();
	virtual void				Shutdown();
	virtual void				Tick(float dt);
	virtual void				StartRumble(int ControllerID) ;
	virtual void				StopRumble(int ControllerID);

private:
	void						UpdatePad(int ID, WPADStatus* pStatus);
	PADStatus					m_WiimoteA[Wiimote::MAX_WIIMOTE];


#ifdef VISUALIZE_WIIMOTE
	struct						AccSamples
	{
		AccSamples() : 	LastUpdate(0), SynchTime(1/60.0f) {};
		std::vector<short>		Values;
		float					LastUpdate;
		float					SynchTime;
		unsigned long			Color;
		void					AddSample(short Sample);
		void					Render(const math::Vec2& From, const math::Vec2& Scale, int LookBack);
	};
	enum						SAMPLES
	{
		SAMPLE_X,
		SAMPLE_Y,
		SAMPLE_Z,
		SAMPLE_C
	};
	AccSamples					m_SampleA[SAMPLE_C];
	
#endif //VISUALIZE_WIIMOTE
};

} //namespace input
#endif //_WIIMOTE_WII_H